<?php

$a[] = "Anna";
$a[] = "Amy";
$a[] = "Brittany";
$a[] = "Bertha";
$a[] = "Carla";
$a[] = "Charlotte";
$a[] = "Cinderella";
$a[] = "Diana";
$a[] = "Eva";
$a[] = "Evelyn";
$a[] = "Fiona";
$a[] = "Gunda";
$a[] = "Hege";
$a[] = "Helen";

$query= $_GET['q'];
if(strlen($query) > 0){
	$response = array();
    for ($i = 0; $i < count($a); $i++){
		$name = $a[$i];
        if (strtolower($query) == strtolower(substr($a[$i], 0, strlen($query)))){
            $response[] = $a[$i];
        }
    }
}
echo json_encode($response);
?>
